import Vue from 'vue'
import Router from 'vue-router'
const recommend = () => import('../components/recommend.vue')
const index = () => import('../components/index.vue')
const hot = () => import('../components/hot.vue')
const search = () => import('../components/search.vue')
const play = () => import('../components/play.vue')
const songlist = () => import('../components/songlist.vue')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'recommend'
    },
    {
      path: '/',
      name: 'index',
      component: index,
      children: [
        {path: 'recommend',component: recommend},
        {path: 'hot',component: hot},
        {path: 'search',component: search},
      ]
    },
    {
      path: '/songlist/:id',
      component:songlist
    },
    {
      // 动态路由，id是变量，表明是那一首歌
      path: '/play/:id',
      component: play
    }
  ]
})
